using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Xml;
using System.IO;


namespace T4Airline
{
    public class WeatherAPI 
    {      
        static void Main(string[] args)
        {
            string output_xml_destination;
            string output_xml_arrival;
            string licenseKey = "2a139f540c5eec04";

            output_xml_destination = "http://api.wunderground.com/api/" + licenseKey + "/conditions/q/Chicago, IL.xml";
            output_xml_arrival     = "http://api.wunderground.com/api/" + licenseKey + "/conditions/q/48088.xml";

            WeatherData weatherDataCall = new WeatherData();
            string result1 = weatherDataCall.parse(output_xml_destination);
            //string result2 = weatherDataCall.parse(output_xml_arrival);

            Console.WriteLine("Place:             " + WeatherData.place);
            Console.WriteLine("Observation Time:  " + WeatherData.obs_time);
            Console.WriteLine("Weather:           " + WeatherData.weather1);
            Console.WriteLine("Temperature:       " + WeatherData.temperature_string);
            Console.WriteLine("Relative Humidity: " + WeatherData.relative_humidity);
            Console.WriteLine("Wind:              " + WeatherData.wind_string);
            Console.WriteLine("Pressure (mb):     " + WeatherData.pressure_mb);
            Console.WriteLine("Dewpoint:          " + WeatherData.dewpoint_string);
            Console.WriteLine("Visibility (km):   " + WeatherData.visibility_km);
            Console.WriteLine("Location:          " + WeatherData.longitude + ", " + WeatherData.latitude);
            Console.WriteLine("Precipitation:     " + WeatherData.precip_today_string);
            Console.WriteLine("");

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
    }

	//[TestFixture]
	//public class TestClass
	//{
	//	[Test]
	//	public void parseTest()
	//	{
	//		string output_xml_destination;
	//		string output_xml_arrival;
	//		string licenseKey = "2a139f540c5eec04";

	//		output_xml_destination = "http://api.wunderground.com/api/" + licenseKey + "/conditions/q/IL/Chicago.xml";
	//		output_xml_arrival= "http://api.wunderground.com/api/" + licenseKey + "/conditions/q/48088.xml";

	//		WeatherData weatherDataCallTest = new WeatherData();
	//		string resultTest = weatherDataCallTest.parse(output_xml_destination);
	//		Assert.AreEqual("West Loop - Old St. Pats, Chicago, Illinois", WeatherData.place);
	//		Assert.AreEqual("2a139f540c5eec04_", licenseKey);
	//	}
	//}
}

